home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 5 / Amiga Plus Sonderheft 1996 #5.iso / programme / visual / rexx / imagefx.rexx < prev    next >
OS/2 REXX Batch file  |  1996-05-27  |  2KB  |  112 lines

  1. /*
  2.  * $VER: 1.01 (2-mar-1995)
  3.  *
  4.  * Arexx program for Visual to generate thumbnails with ImageFX.
  5.  * Written by C.Vallee
  6.  *
  7.  * This script generates thumbnails for all the selected file
  8.  *
  9.  */
  10.  
  11. options results
  12. gfxport = IMAGEFX.1
  13.  
  14. /* Loading ImageFX, if not present */
  15.  
  16. if (~show('p',gfxport)) then do
  17.    message "Loading ImageFX..."
  18.    address command "run ImageFX:ImageFX Iconify Quiet WB"
  19.    message "Waiting for the "||gfxport||" ARexx port..."
  20.  
  21. /* Waiting for the ARexx port every 2 seconds until present */
  22.    do while (~show('p',gfxport))
  23.       address command "Wait 2"
  24.       check
  25.       if rc ~= 0 then exit
  26.    end
  27. end
  28.  
  29. GetInfo
  30. parse var result '"' mypalette '"' w h .
  31.  
  32. address value gfxport
  33.  
  34. Redraw Off
  35. Undo Off
  36.  
  37. Render Mode Hires Lace Ham
  38. Render Colors 64
  39.  
  40. LockRange 0 Off
  41. Palette 8
  42. LoadPalette '"'mypalette'"' '-1'
  43. LockRange 0 On
  44.  
  45. address
  46.  
  47. do forever
  48.    check
  49.    if rc ~= 0 then break
  50.  
  51.    getselected
  52.    if result = "" then break
  53.    file = result
  54.  
  55.    i = LASTPOS('/', file)
  56.    if i = 0 then i = lastpos(':', file)
  57.    name = substr( file , i+1 )
  58.  
  59.    message 'Loading "'||name||'"...' 
  60.  
  61.    address
  62.    LoadBuffer '"'file'"' Force NoSmooth
  63.  
  64.    if rc = 0 then do
  65.       GetMain
  66.       parse var result '"' . '"' width height d .
  67.  
  68.       if ( width > w ) | (height > h) then do
  69.          if ( width * h ) > (height * w ) then do
  70.             height = ( height * w ) % width
  71.             width = w
  72.          end
  73.          else do
  74.             width = ( width * h ) % height
  75.             height = h
  76.          end
  77.       end
  78.  
  79.       address VISUAL message 'Scaling "'||name||'"...'
  80.       Scale width height
  81.  
  82.       if d == 1 then do
  83.          address VISUAL message 'Grey2Color "'||name||'"...'
  84.          Grey2Color
  85.       end
  86.  
  87.       address VISUAL message 'Rendering "'||name||'"...'
  88.       Render Go
  89.  
  90.       SaveRenderedAs ILBM '"'file'.icn"'
  91.  
  92.       Render Close
  93.     
  94.       KillBuffer Force
  95.  
  96.       address
  97.       update
  98.       end
  99.    else do
  100.       address
  101.       unselect
  102.    end
  103. end
  104.  
  105. address
  106.  
  107. Undo On
  108. Redraw On
  109.  
  110. /* Quit ImageFX */
  111. Quit force
  112.